﻿
namespace HSS.Collections
{
	#region Using Directives
	using System.Collections;
	using System.Globalization;
	#endregion

	#region InvariantComparer
	/// <summary>
	/// Helper IComparer for InvariantCulture
	/// </summary>
	internal class InvariantComparer : IComparer
	{
		internal static readonly InvariantComparer Default = new InvariantComparer();
		private CompareInfo m_compareInfo = CultureInfo.InvariantCulture.CompareInfo;

		internal InvariantComparer()
		{
		}
		/// <summary>
		/// Perform the comparison.
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		public int Compare(object a, object b)
		{
			string str = a as string;
			string str2 = b as string;
			if ((str != null) && (str2 != null))
				return this.m_compareInfo.Compare(str, str2);
			return Comparer.Default.Compare(a, b);
		}
	}
	#endregion
}